<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
</html>

<script>
    var per = new Permise(function (resolve, reject) {
        $.ajax({
            url: "/user",
            dataType: "af",
            success(err) {
                resolve(err);
            },
            error(err) {
                reject(err);
            }
        })
    });

    per.then(
        function (arr) { console.log(arr) },
        function (err) { console.log(err) }
    );
</script>